#ifndef __LIST_H
#define __LIST_H

#ifdef __cplusplus
extern "C"{
#endif

#include "stdint.h"

#define list_malloc 					malloc
#define list_free   					free
#define list_lock						0	//保留
#define list_unlock						0	//保留
#define list_printf(format,args...)	    printf(format,##args)
#define list_assert(expression)			do{\
											if(!(expression))\
											{\
												printf("error at file:%s line %d\r\n",__FILE__,__LINE__);\
												while(1);\
											}\
										}while(0)
#define contain_of(ptr,type,member) 		(type*)((char*)ptr - (char*)(offsetof(type,member)))

typedef struct SListNode
{
	struct SListNode* prev;
	struct SListNode* next;
}ListNode;

ListNode* ListInit(void);
ListNode* CreateListNode(void);
void ListDestory(ListNode** pphead);
void ListClear(ListNode* phead);
void Listprint(ListNode* phead);
uint8_t ListPushBack(ListNode* phead, ListNode* NewNode);
uint8_t ListPushFront(ListNode* phead, ListNode* NewNode);
uint8_t ListPopBack(ListNode* phead);
uint8_t ListPopFront(ListNode* phead);
// ListNode* ListFind(ListNode* phead);
uint8_t ListInsert(ListNode* phead, ListNode* pos, ListNode* NewNode);
uint8_t ListErase(ListNode* phead, ListNode** pos);
int ListLength(ListNode* phead);


#ifdef __cplusplus
}
#endif
#endif
 
